package com.example.smartcity_40.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.WindowManager
import com.example.smartcity_40.databinding.CustomDialogBinding
import com.example.smartcity_40.tool.Tool

class CustomDialog(context: Context) : Dialog(context) {
    lateinit var vb: CustomDialogBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        vb = CustomDialogBinding.inflate(layoutInflater)
        setContentView(vb.root)

        vb.dialogIp.setText(Tool.server)
        vb.dialogPort.setText(Tool.port)

        val params = window?.attributes
        params?.width = WindowManager.LayoutParams.MATCH_PARENT
        params?.height = WindowManager.LayoutParams.WRAP_CONTENT
        window?.attributes = params

        vb.dialogOK.setOnClickListener {
            dismiss()
        }

        vb.dialogCancel.setOnClickListener {
            dismiss()
        }
    }
}